const until = require('../until/until')
const fs = require('fs')
const path = require('path')

const homePieInfoUrl = 'asset/data/homePieInfo.json'

const homePieInfoPath = path.join(__dirname, '../', homePieInfoUrl)

const homeDao = {
  pie: (req, res, next) => {
    const data = fs.readFileSync(homePieInfoPath)
    const homePieInfoData = JSON.parse(data.toString())
    console.log(homePieInfoData)
    res.json(until.formatter(200, '操作成功', homePieInfoData))
  },
}

module.exports = homeDao
